alter trigger [dbo].[tfb_wagepaydtl_bd] ON [dbo].[tfb_wagepaydtl]
instead of delete
AS
begin
  set nocount on
  update tfb_wagemonthfix set payed=0
    from tfb_wagemonthfix m, deleted p
    where m.bid=p.wageno and m.empid=p.empid
  delete from tfb_wagepaydtl where exists(select 1 from deleted where tfb_wagepaydtl.bid=deleted.bid)
end